
// 当返回的数据是这种格式的时候  {“responseCode”: 0, “message”: “”, “entry”: {}}
import 'EntityFactory.dart';

class BaseEntity<T> {
  String? responseCode;
  String? message;
  T? entry;

  BaseEntity({this.responseCode, this.message, this.entry});

  factory BaseEntity.fromJson(json) {
    return BaseEntity(
      responseCode: json["responseCode"].toString(),
      message: json["message"],
      // entry值需要经过工厂转换为我们传进来的类型
      entry: EntityFactory.generateOBJ<T>(json["entry"]),
    );
  }
}
